package com.itheima.app.controller;

import com.itheima.app.manager.TestSoulManager;
import com.itheima.domain.db.UserLogin;
import com.itheima.vo.AnswersVo;
import com.itheima.vo.ReportVo;
import com.itheima.vo.TopicVo;
import com.itheima.vo.UserLoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 测灵魂模块
 */
@RestController
@RequestMapping("/testSoul")
@Api(tags = "灵魂测试")
public class TestSoulController {

    @Autowired
    private TestSoulManager testSoulManager;

    //查询问卷
    @GetMapping
    @ApiOperation("查询问卷")
    public List<TopicVo> search() {
        return testSoulManager.search();
    }

    //提交问卷
    @PostMapping
    @ApiOperation("提交问卷")
    public Long submit(@RequestBody AnswersVo answersVo) {
        return testSoulManager.submit(answersVo);
    }

    @GetMapping("/report/{id}")
    @ApiOperation("查询问卷报告")
    public ReportVo queryResult(@PathVariable Long id) {
        return testSoulManager.queryResult(id);
    }
}
